#pragma once

#include <list>
#include "BoundingVolume.h"


class IScenery;
class IMovable;
class PhysicalObject;

class CCollisionController
{
private:
   IScenery* m_scenery;
   std::list<IMovable*> m_movables;
   std::list<PhysicalObject*> m_physicalObjects;
   AABoundingBox m_worldBounds;

public:
   CCollisionController();
   ~CCollisionController();

   void setScenery(IScenery& scenery);

   PhysicalObject& addMovable(IMovable& movable);

   void addGhost(IMovable& movable);

   void removeMovable(IMovable& movable);

   void setWorldBounds(const AABoundingBox& bounds);

   void update(float timeElapsed);

   void clearScene();

private:
   void keepInWorldBound(IMovable& movable);

   void checkCollisionWithScenery(IMovable& movable);

   void checkInterMovableCollisions(PhysicalObject& colidor, PhysicalObject& obstacle);
};
